package com.yc.web.servlet;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author 千古旧殇
 */
@WebServlet("/demo3")
public class Sevrtlet_test3 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("get....");
        PrintWriter writer = resp.getWriter();
        writer.println("hello doGet!");
        writer.close();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("post...");
        PrintWriter writer = resp.getWriter();
        writer.println("<h1>HELLO DOPOST</h1>");
        writer.close();
    }
}
